<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>学生调班</title>
	<%
    	String path = request.getContextPath();
	    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
    %>
	<c:set var="path" value="<%=basePath %>"></c:set>
 	<link href="${path }/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
 	<link href="${path }/css/form-public.css" rel="stylesheet" />
 	<link rel="stylesheet" type="text/css" href="${path }/js/zeroModal/zeroModal.css" />
 	<link rel="stylesheet" href="./layui/css/layui.css"  media="all">
</head>
<body>
<form class="layui-form layui-form-pane" action="updateStuByClassPost" method="post">
  <div style="padding-top: 50px;padding-left: 300px">
  	  <div style="margin-left: 150px;padding-bottom: 10px;color:red">
  	  	<h2>学生调班</h2>
  	  </div>
  	  <input type="hidden" id="hiddenId" name="hiddenId"/>
  	  <div class="layui-form-item">
	    <label class="layui-form-label">学生名称</label>
	    <div class="layui-input-block">
	    
	    <input type="text" id="userName" value="" name="userName" readonly="true" style="width: 250px"  autocomplete="off"  class="layui-input"/>
	    </div>
	  </div>
	  <div class="layui-form-item">
	  	<label class="layui-form-label">新的班级</label>
		  <div class="layui-input-inline" style="width: 250px">
			<select id="class1" name="class1" lay-verify='required' lay-search=''>
			</select>  
		  </div>
	  </div>
	  <div class="layui-form-item">
	    <div class="layui-input-block">
	      <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
	      <button type="reset" onclick="goclass()" class="layui-btn layui-btn-primary">返回</button>
	    </div>
	  </div>
  </div>
</form>

<script type="text/javascript" src="./js/jquery-3.1.1.js"></script>
<script type="text/javascript" src="./js/jqueryui/jquery-ui.js"></script>
<script src="./layui/layui.js" charset="utf-8"></script>    
	
<script>
/* $(function(){
	gettecher();
}); */
function goclass(){
	
}
layui.use(['form', 'layedit', 'laydate'], function(){
	var form = layui.form;
	getClass(form);
	getStu(form);
});
function getStu(form){
	$.ajax({
		url:'getStudentsByClass',
		datatype:'json',
		success:function(data){
			var stu=data.students;
			console.log(stu);
			$("#userName").val(stu.user_name);
			$("#hiddenId").val(stu.user_id);
			form.render();
		} 
	});
}
function getClass(form){
	$.ajax({
		url:'gethb',
		datatype:'json',
		success:function(data){
			var array3=data.classInfo;
			var str2="<option value=''>请选择班级</option>";
			for (var i = 0; i < array3.length; i++) {
				str2+="<option value="+array3[i].clazz_id+">"+array3[i].clazz_name+"</option>";
			}
			$("#class1").append(str2);
			form.render('select');
		} 
	});
}
</script>
</body>
</html>